<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <title>新尚镁</title>
    <link rel="stylesheet" href="./css/style.css">
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>

<body>
    <img src="./images/img1.png" alt="" />
    <div class="download">
        <div class="yqmText">邀请码：<span id="invitationCode"></span></div>
        <a id="androidDownloadUrl" href="">安卓下载</a>
    </div>
    <img src="./images/img2.png" alt="" />

    <script>
        // 可选地，上面的请求可以这样做
        axios.get('http://39.106.180.25:9091/tourist/invitation/' + getQueryVariable('code'), {
            params: {
                ID: 12345
            }
        }).then(function (response) {
            console.log(response.data.data);
            document.getElementById("invitationCode").innerHTML = response.data.data.invitationCode
            document.getElementById("androidDownloadUrl").href = response.data.data.androidDownloadUrl
        }).catch(function (error) {
            console.log(error);
        });

        function getQueryVariable(variable) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == variable) { return pair[1]; }
            }
            return (false);
        }
        
    </script>
</body>

</html>
